#include "cs32f0xx.h"                   // Device header
#include "cs32f0xx_gpio.h"              // Chipsea::Device:HAL:GPIO
#include "cs32f0xx_usart.h"             // Chipsea::Device:HAL:USART
#include "cs32f0xx_rcu.h"               // Chipsea::Device:HAL:RCU
#include "main.h"

uint8_t len = 0;
uint8_t USART_buf[11];

extern uint32_t SystemCoreClock;



int main(void)
{
	uint8_t  tx_buf[60];
	uint8_t print_len = 0;
	uint32_t sample_value;
	uint32_t real_value;
	
	//myusart_init();
	myadc_init();
	softusart_init();
	led_init();
	tim_delay_init(47,99);
	
	while(1)
	{
		
//		memset(tx_buf,0,60);
//		while(adc_flag_status_get(ADC1, ADC_FLAG_EOCH) == RESET); // Check EOC flag		
//		sample_value = adc_conversion_value_get(ADC1);  
//		real_value = (sample_value *3300)/0xFFF;
//		print_len = sprintf((char*)tx_buf, "  ADC_CH0 = %d mV.\n\r",real_value);
//		usart_send(tx_buf, print_len);
	}
	
	return 0;
}
